package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryBinTransferPageUtil extends SeleniumPageUtil {
	public final static By IBT_SPAN_HEADER = By.id("ctl44_lblHdr");
	public final static By IBT_TD_WAREHOUSE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr/td[1]");
	public final static By IBT_INPUT_WAREHOUSE = By.id("ctl44_txtWarehouse");
	public final static By IBT_INPUT_SUBMIT = By.id("ctl44_btnSubmit");
	
	public static void enterInventoryBinTransferPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryBinTransferPage();
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				IBT_SPAN_HEADER, IBT_TD_WAREHOUSE, IBT_INPUT_WAREHOUSE, IBT_INPUT_SUBMIT
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IBT_SPAN_HEADER));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IBT_TD_WAREHOUSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IBT_INPUT_WAREHOUSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IBT_INPUT_SUBMIT));
	}
}
